import Vue from 'vue'
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import App from './App.vue'
import router from './router'
//import store from './store'


Vue.config.productionTip = false;

Vue.use(ElementUI);

//导入axios
import axios from 'axios';
Vue.prototype.$http = axios;
axios.defaults.baseURL = 'http://yyadmin.com/index.php';
//请求拦截器
axios.interceptors.request.use(config => {
	config.headers.Authorization = window.sessionStorage.getItem('token');
	return config;
});

//响应拦截器
axios.interceptors.response.use(success =>{
	if(success.status && success.status == 200){
		if(success.data.code ==401){
			router.replace('/')
		}
	}
	return success;
});


new Vue({
  router,  
  render: h => h(App)
}).$mount('#app')
